package k3_annotation.demo02;

import org.junit.Test;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

public class MyAnnotation {

    @Test
    @StandardDoc(date = "2025-4-29",author = "李宗波")
    public void test(){
        System.out.println("test....");
    }


    @Test
    public void processAnnotation() throws Exception {
        Class clazz = MyAnnotation.class;
        Method testMethod = clazz.getDeclaredMethod("test");
        //判断此方法中是否存在 StandardDoc 这个注解
        if (testMethod.isAnnotationPresent(StandardDoc.class)) {
            StandardDoc annotation = testMethod.getDeclaredAnnotation(StandardDoc.class);
            System.out.println(annotation.author());
            System.out.println(annotation.date());
            System.out.println(annotation.version());
        }
    }



}
